package org.steven.crm.core.data;

import com.steven.common.errors.StandardErrors;

public class Result {
	private boolean success;
	private String code;
	private String message;
	private Object data;
	
	public Result() {
		this.success = true;
		this.code = "200";
		this.message = "";
	}
	
	public void setError(String code, String message) {
		this.success = false;
		this.code = code;
		this.message = message;
	}

	public void setError(StandardErrors.ServerError serverError) {
		this.success = false;
		this.code = serverError.getCode();
		this.message = serverError.getMessage();
	}
	
	public void setData(Object data) {
		this.data = data;
	}
	
	public Object getData() {
		return data;
	}
	
	public boolean isSuccess() {
		return success;
	}

	public void setSuccess(boolean success) {
		this.success = success;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}
}
